package com.sell.sell.service.impl;

import com.sell.sell.dao.ProductInfoDao;
import com.sell.sell.entity.ProductInfo;
import com.sell.sell.enums.ProductStatusEnum;
import com.sell.sell.service.ProductInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * 描述:
 * ${DESCRIPTION}
 *
 * @author hzp
 * @create 2018-09-29 12:42
 */
@Service
public class ProductInfoServiceImpl implements ProductInfoService {

    @Autowired
    private ProductInfoDao productInfoDao;

    @Override
    //获取上架的商品
    public List<ProductInfo> findAllUp() {
        return productInfoDao.findByProductStatusEquals(ProductStatusEnum.UP.getCode());
    }

    @Override
    public ProductInfo findOne(String productId) {
        return productInfoDao.findFirstByProductIdEquals(productId);

    }
}
